package com.ruoyi.system.api.factory;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.system.api.RemoteSijiService;
import com.ruoyi.system.api.RemoteUserService;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.system.api.model.LoginUser;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class RemoteSijiFallbackFactory implements FallbackFactory<RemoteSijiService> {

    private static final Logger log = LoggerFactory.getLogger(RemoteSijiFallbackFactory.class);
    @Override
    public RemoteSijiService create(Throwable throwable) {
        log.error("用户服务调用失败:{}", throwable.getMessage());
        return new RemoteSijiService()
        {

            @Override
            public AjaxResult getAllDriverByDeptId(String deptId) {
                return AjaxResult.error("调用失败","501");
            }

            @Override
            public AjaxResult getFactoryByDeptId(Integer deptId) {
                return AjaxResult.error("调用失败2","500");
            }
        };
    }
}
